package com.example.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.example.pojo.utils.RouteMeta;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * TODO
 *
 * @author ding
 * @since 2024/7/2
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("menu")
public class RouteItem implements Serializable {

    @TableId(type = IdType.AUTO)
    private Integer id;
    private String path;
    private String menuName;
    private String name;
    private String component;
    /** 菜单样式 */
    @TableField(exist = false)
    private RouteMeta meta;
    /** 重定位路径 */
    private String redirect;
    @TableField(exist = false)
    private RouteItem[] children;
    /** 父菜单和子菜单标识 */
    private String serial;

    /** 图标 */
    private String icon;

    /** 父菜单ID */
    private Integer parentMenu;
    /** 菜单级别 */
    private  Integer level;
    /** 菜单转态 0：禁用  1：启用  */
    private String status;

    /** 菜单类型 0：目录；1：菜单；2：按钮 */
    private String type;

   /** 是否显示 0：显示；1：不显示 */
//    @TableField(value = "is_show")
    @TableField(exist = false)
    private String show;
    /** 是否缓存 */
    @TableField(exist = false)
    private String keepalive;

    /** 是否外链 0：否；1：是 */
    private String isExt;

    private Integer isSensitive;
    @TableField(exist = false)
    private Boolean caseSensitive;

    /** 菜单顺序 */
    private Integer orderNo;

    /** 乐观锁版本号 */
    @ApiModelProperty("乐观锁版本号")
    @Version
    @TableField(value = "version", fill = FieldFill.INSERT)
    private Integer version;

    private Integer isDeleted;

    /** 创建时间 */
    @TableField(fill = FieldFill.INSERT)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createTime;
    /** 更新时间 */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime updateTime;
}
